import {getCurrentInstance} from 'vue'

export function useGlobalProperties() {
	const currentInstance = getCurrentInstance()
	if (!currentInstance) {
		throw Error('useGlobalProperties() can only be used inside setup() or functional components!')
	}
	const {appContext} = currentInstance
	return appContext.config.globalProperties
}

export function useRefs() {
	const currentInstance = getCurrentInstance()
	if (!currentInstance) {
		throw Error('useGlobalProperties() can only be used inside setup() or functional components!')
	}
	return currentInstance.refs
}
